package com.itheima.mapper;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface UserMapper {
    @Select("select * from user")
    @Results({
            @Result(id=true,column = "id",property = "id"),
            @Result(column = "username",property = "username"),
            @Result(property = "ordersList",javaType =List.class,column = "id",
                    many = @Many(select = "com.itheima.mapper.OrdersMapper.findByUid",fetchType = FetchType.LAZY))
    })
    List<User> findUserAndOrders();
}
